package controller;

import bean.StudentInfo;
import service.IStudentInfoService;
import service.impl.StudentInfoServiceImpl;

import java.util.List;

public class StudentInfoController {

    IStudentInfoService studentInfoService=new StudentInfoServiceImpl();

    /**
     * 查询用户信息
     * @return
     * @throws Exception
     */
    public List<StudentInfo> queryStudentInfo() throws Exception{

        return studentInfoService.queryStudentInfo();
    }


    public boolean insertStudentInfo(StudentInfo studentInfo) throws  Exception{

        boolean flag = studentInfoService.insertStudentInfo(studentInfo);

        if(flag){
            System.out.println("插入成功");
        }
        else{
            System.out.println("插入失败");
        }

        return flag;
    }

    public boolean updateStudentInfo(StudentInfo studentInfo) throws Exception{

        boolean flag = studentInfoService.updateStudentInfo(studentInfo);

        if(flag){
            System.out.println("修改成功");
        }
        else{
            System.out.println("修改失败");
        }

        return flag;

    }

    public boolean deleteStudentInfo(int id) throws Exception{
        boolean flag = studentInfoService.deleteStudentInfo(id);

        if(flag){
            System.out.println("删除成功");
        }
        else{
            System.out.println("删除失败");
        }
        return flag;
    }
}
